package ferp.android.tasks.center;

import android.os.AsyncTask;
import ferp.center.client.Action;
import ferp.core.log.Log;

import java.io.IOException;

/**
 * User: olegs
 * Date: 12/17/13 3:44 PM
 */
public class TaskEngagement extends AsyncTask<Void, Void, Void>
{
  public TaskEngagement(boolean accept)
  {
    this.accept = accept;
  }

  @Override
  protected Void doInBackground(Void... voids)
  {
    try
    {
      Action.execute(accept ? Action.ENGAGEMENT_ACCEPT : Action.ENGAGEMENT_CLEAR, null, null);
    }
    catch (IOException e)
    {
      Log.error(Log.TAG, e);
    }

    return null;
  }

  private boolean accept;
}
